﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;

public partial class Manage_CompanyGMPAdd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAdmin);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAttorney);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumCheckCompany);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumCompany);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumComapanyRG);
        if (HZ.MBSM.BLL.Login.CheckAssert(_AccountType))
        {
        }

    }
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        string AccountId, GMPCode, GMPSatrDate, GMPEndDate, GMPRange;
        HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
        if (_Account != null)
        {
            AccountId = SysFun.ToTrim(MsgBox.JieMi_Decrypt(Request.QueryString["AccountId"]));
            GMPCode = SysFun.ToTrim(txtGmpCode.Text);
            GMPEndDate = SysFun.ToTrim(txtGmpEndDate.Text);
            GMPRange = SysFun.ToTrim(txtGmpRange.Text);
            GMPSatrDate = SysFun.ToTrim(txtGmpStarDate.Text);
            string strSql = "insert into  companygmp (accountid,gmpcode,gmpstardate,gmpenddate,gmprange) values('"
                + AccountId + "','" + GMPCode + "','" + GMPSatrDate + "','" + GMPEndDate + "','" + GMPRange + "')";
            Db db = new Db();
            db.Command(strSql);
            db.Close();
            Response.Write("<script>alert('保存成功！！！');</script>");
            //HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
            HZ.MBSM.BLL.LogManage.RecordLoginDetail(_Account.AccountName, Request.UserHostAddress, "添加", "companygmp", strSql, "../Magage/CompanyGMPAdd.aspx");


        }
        else
        {
            Response.Write("<script language=JavaScript>alert('您无权添加企业GMP信息！！！');</script>");
        }
        Response.Write("<script>window.opener.location.reload();window.close();</script>");
    }
}
